package com.xinjiang.electricpower.timer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.InputStream;

/**
 * @Author D_TZ
 * @Date 2023/2/2813:18
 * @ClassName YujingOrderTask
 * @Desription 预警工单执行
 **/
@Component
@Slf4j
public class YujingOrderTask {




    /**
     * 预警工单执行
     *
     * @return
     */
    @Async
    @Scheduled(cron = "0 0 9-12,15-20 * * ?")  //每1小时执行一次
    public void yjWorkOrderKjb() {
        try {
            log.info("同步预警工单执行定时任务开启~~~~");
            InputStream in = this.getClass().getClassLoader().getResourceAsStream("yujing/app_time_yj_xm.ktr");
            //执行对应ktr 文件转换
            KettleQuartz.runKettleTransfer(null, null, in);
            log.info("同步预警工单执行定时任务结束~~~~");
        } catch (Exception e) {
            log.error("拉取{}工单数据异常 {}", e);
        }
    }




}
